From: Florian Müllner Date: Wed, 26 Oct 2011 17:24:36 +0000 (+0200) Subject: combo-box-menu-item: Propagate pseudo classes to the combo menu X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7301 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b88657ab837a0bb91cebf00a5298269bfdd04cde;p=gnome-shell.git combo-box-menu-item: Propagate pseudo classes to the combo menu ComboBoxMenuItems use ClutterClones to reconstruct the active item in the associated ComboMenu, so pseudo class changes due to state changes of the ComboBoxMenuItem don't have the intended effect (since the actual style information is taken from the associated ComboBoxMenu item). As a fix, propagate relevant pseudo class changes to the active ComboBoxMenu item. https://bugzilla.gnome.org/show_bug.cgi?id=662799 --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 0c047487f..6aee9f419 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -108,14 +108,16 @@ PopupBaseMenuItem.prototype = { this.emit('activate', event); }, - setActive: function (active) { + setActive: function (active, params) { let activeChanged = active != this.active; + params = Params.parse (params, { grabKeyboard: true }); if (activeChanged) { this.active = active; if (active) { this.actor.add_style_pseudo_class('active'); - this.actor.grab_key_focus(); + if (params.grabKeyboard) + this.actor.grab_key_focus(); } else this.actor.remove_style_pseudo_class('active'); this.emit('active-changed', active); @@ -1522,6 +1524,22 @@ PopupComboMenu.prototype = { }, _onSourceActorStyleChanged: function() { + // PopupComboBoxMenuItem clones the active item's actors + // to work with arbitrary items in the menu; this means + // that we need to propagate some style information and + // enforce style updates even when the menu is closed + let activeItem = this._getMenuItems()[this._activeItemPos]; + if (this.sourceActor.has_style_pseudo_class('insensitive')) + activeItem.actor.add_style_pseudo_class('insensitive'); + else + activeItem.actor.remove_style_pseudo_class('insensitive'); + + // To propagate the :active style, we need to make sure that the + // internal state of the PopupComboMenu is updated as well, but + // we must not move the keyboard grab + activeItem.setActive(this.sourceActor.has_style_pseudo_class('active'), + { grabKeyboard: false }); + _ensureStyle(this.actor); },